package com.qf.service.impl;

import cn.hutool.json.JSONUtil;
import com.qf.Movie;
import com.qf.ResultVo;
import com.qf.mapper.MovieMapper;
import com.qf.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MovieServiceImpl implements MovieService {

    @Autowired
    private MovieMapper movieMapper;

    /*根据id查询电影*/
    @Override
    public ResultVo selectMovieById(Integer movieId) {
        Movie movie = movieMapper.selectById(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }

    /*根据id查询演员*/
    @Override
    public ResultVo selectActorById(Integer movieId) {
        Movie movie = movieMapper.selectActorId(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }


    /*根据id查询电影详情*/
    @Override
    public ResultVo selectDescById(Integer movieId) {
        Movie movie = movieMapper.selectDescId(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }

    /*根据id查询电影照片*/
    @Override
    public ResultVo selectMoviePicById(Integer movieId) {
        Movie movie = movieMapper.selectMoviePicId(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }

    /*根据id查询电影类型*/
    @Override
    public ResultVo selectTypeById(Integer movieId) {
        Movie movie = movieMapper.selectTypeId(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }

    @Override
    public ResultVo selectUserCommentById(Integer movieId) {
        Movie movie = movieMapper.selectUserCommentId(movieId);
        ResultVo resultVo = new ResultVo(200, "成功", movie);
        return resultVo;
    }


}
